package cn.edu.ctbu.myblog.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class CommenController {

    @RequestMapping(value = "/index")
    public String list(HttpServletRequest httpServletRequest){
        HttpSession session=httpServletRequest.getSession();
        if(session.getAttribute("userId")==null){
            return "redirect:login";
        }
        return "blog/front/index";
    }


    @RequestMapping(value = "/detail")
    public String detail(HttpServletRequest httpServletRequest){
        HttpSession session=httpServletRequest.getSession();
        if(session.getAttribute("userId")==null){
            return "redirect:login";
        }

        return "blog/front/detail";
    }

    @RequestMapping(value = "/login")
    public String login(){
        return "blog/login/user";
    }
}
